import request from "@/util/request"
import { API_SITE, API_PREFIX} from "./_prefix"

/**
 * 开始搜索
 */
export const startSearch = (userId,keyword,searchEngine) => {
    return request(`${API_SITE}${API_PREFIX}/${userId}/search`,{
        method: "POST",
        body: {
            keyword: keyword,
            searchEngine: searchEngine
        }
    })
}

/**
 * 停止搜索
 */
export const stopSearch = (userId,searchTaskId) => {
    return request(`${API_SITE}${API_PREFIX}/${userId}/search/${searchTaskId}/stop`,{
        method: "POST"
    })
}

/**
 * 获取搜索结果
 */
export const getSearchResult = (userId,searchTaskId,offset,limit) => {
    return request(`${API_SITE}${API_PREFIX}/${userId}/search/${searchTaskId}?offset=${offset}&limit=${limit}`)
}